//
//  CellOfSelection.m
//  ProjectA_ManualGuest
//
//  Created by dingcong on 16/6/14.
//  Copyright © 2016年 丁聪. All rights reserved.
//

#import "CellOfSelection.h"
#import "Masonry.h"
#import "UIImageView+WebCache.h"
#import "RootVCOfVidio.h"
@implementation CellOfSelection


- (void)dealloc
{
    [_imageOfTV release];
    [_imageOfPlayer release];
    [_imageOfSecondKill release];
    [_lableOfTV release];
    [_lableOfPlayer release];
    [_lableOfSecondKill release];
    [_webViewTap release];
    [_strOflink_info release];
    [_tap release];
    [_tapOfLive release];
    [_model release];
    
    [super dealloc];
    
    
}

#pragma mark - overWrite
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self creat];
        self.backgroundColor = [UIColor clearColor];
    }
    
    return self;
    
    
    
}

#pragma mark - cell控件
- (void)creat
{
    
    self.imageOfTV = [[UIImageView alloc]init];
    [self.contentView addSubview:self.imageOfTV];
    [self.imageOfTV mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView.mas_top).with.offset(8);
        make.leading.equalTo(self.contentView.mas_leading).with.offset(SCREEN_WIDTH / 14.5);
        
        make.height.offset(50);
        make.width.offset(55);
    }];
//    self.imageOfTV.backgroundColor = [UIColor cyanColor];
    self.tap = [[UITapGestureRecognizer alloc]init];
    [self.imageOfTV addGestureRecognizer:self.tap];
    self.imageOfTV.userInteractionEnabled = YES;
    [self.tap release];
    


    
    
    [self.imageOfTV release];
    
    
    
    
    
    self.lableOfTV = [[UILabel alloc]init];
    [self.contentView addSubview:self.lableOfTV];
    [self.lableOfTV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imageOfTV.mas_bottom).with.offset(5);
        make.centerX.equalTo(self.imageOfTV.mas_centerX);
        make.height.offset(30);
        make.width.offset(87);
    }];
//    self.lableOfTV.backgroundColor = [UIColor redColor];
    
    [self.lableOfTV release];
    
    /*字体居中*/
    self.lableOfTV.textAlignment = NSTextAlignmentCenter;
    self.lableOfTV.textColor = [UIColor grayColor];
    self.lableOfTV.font = [UIFont systemFontOfSize:14.5];
//
//    
    self.imageOfPlayer = [[UIImageView alloc]init];
    [self.contentView addSubview:self.imageOfPlayer];
    [self.imageOfPlayer mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.imageOfTV.mas_centerY);
        make.height.equalTo(self.imageOfTV.mas_height);
        make.width.equalTo(self.imageOfTV.mas_width);
        make.leading.equalTo(self.imageOfTV.mas_trailing).with.offset(SCREEN_WIDTH / 4.4);
    }];
    self.tapOfLive = [[UITapGestureRecognizer alloc]init];
    
    [self.imageOfPlayer addGestureRecognizer:self.tapOfLive];
    
    self.imageOfPlayer.userInteractionEnabled = YES;
    
    [self.tapOfLive release];
    
    
    
//    self.imageOfPlayer.backgroundColor = [UIColor lightGrayColor];
    
    [self.imageOfPlayer release];

    
    self.lableOfPlayer = [[UILabel alloc]init];
    [self.contentView addSubview:self.lableOfPlayer];
    [self.lableOfPlayer mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.lableOfTV.mas_centerY);
        make.height.equalTo(self.lableOfTV.mas_height);
        make.width.equalTo(self.lableOfTV.mas_width);
        make.leading.equalTo(self.lableOfTV.mas_trailing).with.offset(SCREEN_WIDTH / 6.6);
    }];
//    self.lableOfPlayer.backgroundColor = [UIColor lightGrayColor];
    self.lableOfPlayer.textAlignment = NSTextAlignmentCenter;
    self.lableOfPlayer.textColor = [UIColor grayColor];
    self.lableOfPlayer.font = [UIFont systemFontOfSize:14.5];
    
    [self.lableOfPlayer release];
    
//
//    
//    
//    
//    
//    
//    
//    
    self.imageOfSecondKill = [[UIImageView alloc]init];
    [self.contentView addSubview:self.imageOfSecondKill];
    [self.imageOfSecondKill mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.imageOfPlayer.mas_centerY);
        make.height.equalTo(self.imageOfTV.mas_height);
        make.width.equalTo(self.imageOfTV.mas_width);
        make.leading.equalTo(self.imageOfPlayer.mas_trailing).with.offset(SCREEN_WIDTH / 4.4);
    }];
    
    self.webViewTap = [[UITapGestureRecognizer alloc]init];
    [self.imageOfSecondKill addGestureRecognizer:self.webViewTap];
    self.imageOfSecondKill.userInteractionEnabled = YES;
    [self.webViewTap release];
    
    
    

    
    [self.imageOfSecondKill release];
//
//    
    self.lableOfSecondKill = [[UILabel alloc]init];
     [self.contentView addSubview:self.lableOfSecondKill];
    [self.lableOfSecondKill mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.lableOfPlayer.mas_centerY);
        make.height.equalTo(self.lableOfTV.mas_height);
        make.width.equalTo(self.lableOfTV.mas_width);
        make.leading.equalTo(self.lableOfPlayer.mas_trailing).with.offset(SCREEN_WIDTH / 6.6);
    }];
//    self.lableOfSecondKill.backgroundColor = [UIColor lightGrayColor];
   
    [self.lableOfSecondKill release];
//    self.lableOfSecondKill.backgroundColor = [UIColor lightGrayColor];
    self.lableOfSecondKill.textAlignment = NSTextAlignmentCenter;
    self.lableOfSecondKill.textColor = [UIColor grayColor];
    self.lableOfSecondKill.font = [UIFont systemFontOfSize:14.5];
    
    
    
    
    
}

#pragma mark - 赋值
- (void)setModel:(SelectionModel *)model
{
    
    NSLog(@"%@", model.link_info);
    
    if ([model.type isEqualToString:@"1"])
    {
       
        [self.imageOfTV sd_setImageWithURL:[NSURL URLWithString:model.pic] placeholderImage:[UIImage imageNamed:@"13.png"]];
        
        self.lableOfTV.text = model.name;
    }
    else if ([model.type isEqualToString:@"2"])
    {
        [self.imageOfPlayer sd_setImageWithURL:[NSURL URLWithString:model.pic] placeholderImage:[UIImage imageNamed:@"13.png"]];
        
        self.lableOfPlayer.text = model.name;
        
        
    }
    else if ([model.type isEqualToString:@"3"])
    {
        [self.imageOfSecondKill sd_setImageWithURL:[NSURL URLWithString:model.pic] placeholderImage:[UIImage imageNamed:@"13.png"]];
        
        self.lableOfSecondKill.text = model.name;
        
        self.strOflink_info = model.link_info;
        NSLog(@"%@", self.strOflink_info);
    }
    
    
}


@end
